package com.usian.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.usian.dao.TeacherMapper;
import com.usian.pojo.Teacher;
import com.usian.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    private TeacherMapper teacherMapper;


    @Override
    public void update(Integer sname ,Integer id) {
        Teacher teacher = teacherMapper.selectByPrimaryKey(id);
                teacher.setSname(teacher.getSname()+","+sname);
        teacherMapper.updateByPrimaryKeySelective(teacher);
    }

    @Override
    public void add(Teacher teacher) {
        teacherMapper.insert(teacher);
    }

    @Override
    public void delete(Integer id) {
        teacherMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Teacher select(Integer id) {
        return teacherMapper.selectByPrimaryKey(id);
    }
}
